/**
 * 
 */
package jgame.Inventory;

import java.io.*;
import java.util.HashMap;
import java.util.Iterator;

/**
 * @author Justin Sturm
 *
 */
public class JGameItemSet {
	HashMap<String, JGameItem> items;
	BufferedReader reader;
	
	public JGameItemSet()
	{
		items = new HashMap<String, JGameItem>();
		try {
			reader = new BufferedReader(new FileReader(getClass().getClassLoader().getResource(".").getPath() + "jgame/Resources/Game Item Set"));
		} catch (FileNotFoundException e) {
			System.out.println("Couldn't Find Game Items");
			e.printStackTrace();
		}
		getGameItemSet();
	}
	
	private void getGameItemSet()
	{		
		String a;
		String b;
		String c;
		
		try {
			String line;
			while((line = reader.readLine())!=null)
			{
				a = line;
				b = reader.readLine();
				c = reader.readLine();				
				items.put(a,new JGameItem(a,b,c));
			}
		} catch (IOException e) {
			System.out.println("Trouble Reading Game Item Set");
			e.printStackTrace();
		}		
	}
	
	public void printItemSet()
	{
		Iterator<JGameItem> t = items.values().iterator();
		while(t.hasNext())
		{
			t.next().printItem();
		}
	}
}
